/*
 * @lc app=leetcode.cn id=830 lang=javascript
 *
 * [830] 较大分组的位置
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number[][]}
 */
var largeGroupPositions = function(s) {
    let i=0,j=1,count=1
    let res=[]
    while(j<s.length){
        if(s[i]==s[j]){j++;count++}
        else{
            if(count>=3)res.push([i,j-1])
            i=j
            j++
            count=1
        }
    }
    if(s[i]==s[j]){j++;count++}
    if(count>=3)res.push([i,j-1])
    return res
};
// @lc code=end

